package com.bao.work;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;

/**
 * @author baoye
 * @date 2024-08-06/17:23
 */
public class Work01 {
    public static void main(String[] args) throws IOException {
        String str="湖北地";
        ByteArrayOutputStream bos=new ByteArrayOutputStream();
        bos.write(str.getBytes());
        bos.flush();
        bos.close();
        ByteArrayInputStream bis=new ByteArrayInputStream(bos.toByteArray());
        byte[] bytes=new byte[1024];
        int len;
        while((len=bis.read(bytes))!=-1){
            System.out.println(new String(bytes, 0, len));
        }
    }
}
